package net.itbaiyang.pattern.enums;

public enum MailTypeEnum {

    // 简单邮件
    SIMPLE_MAIL("simple_mail"),

    // html邮件
    HTML_MAIL("html_mail"),

    //附件邮件
    ATTACH_MAIL("attach_mail"),

    //嵌入静态资源的邮件
    INLINE_MAIL("inline_mail"),

    //未知的邮件类型
    UNKONWN_MAIL("unkonwn_mail");

    private final String type;

    MailTypeEnum(String type) {
        this.type = type;
    }

    public String getType() {
        return type;
    }

    // 通过字符串值获取枚举类型
    public static MailTypeEnum fromString(String type) {
        for (MailTypeEnum mailType : MailTypeEnum.values()) {
            if (mailType.getType().equalsIgnoreCase(type)) {
                return mailType;
            }
        }
        return UNKONWN_MAIL;
    }
}
